package com.xd.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import com.xd.entity.Homework;
import com.xd.repository.HomeworkRepositroy;
import com.xd.service.HomeworkService;
import com.xd.vo.HomeworkVo;

@Service
public class HomeworkServiceImpl implements HomeworkService{
@Resource
HomeworkRepositroy homeworkRepositroy;

@Override
public void add(HomeworkVo homeworkVo) {
	// TODO Auto-generated method stub
	Homework h=new Homework();
	BeanUtils.copyProperties(homeworkVo, h);
	homeworkRepositroy.save(h);
}

@Override
public void del(Long id) {
	// TODO Auto-generated method stub
	homeworkRepositroy.delete(id);
}

@Override
public void giveScore(Float score, Long id) {
	// TODO Auto-generated method stub
	homeworkRepositroy.giveScore(score, id); 
}

@Override
public List<Homework> findall() {
	// TODO Auto-generated method stub
	List<Homework> ls=homeworkRepositroy.findAll();
	return ls;
}

	

}
